package com.iot.util;
import org.apache.log4j.Logger;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class PropertiesReader {
    private static final Logger logger = Logger.getLogger(PropertiesReader.class);
    private static Properties prop = new Properties();
    public static Properties readPropertyFile() throws Exception{
        if (prop.isEmpty()){
            InputStream input = PropertiesReader.class.getClassLoader().getResourceAsStream("iot-kafka.properties");
            try{
                prop.load(input);
            }catch (IOException ex){
                logger.error(ex);
            }finally {
                if (input != null){
                    input.close();
                }
            }
        }
        return prop;
    }
}
